<template>
<div id="background">
    <!-- <el-container id="zhuYeTitleBack"> -->
        <el-container>
        <!-- <div id="zhuYeBack"></div> -->
        <el-header id="zhuYeHeadPosition" style="height:170px">
            <div style="position:relative">
                <img src="../../assets/img/mine/background.png" style="height:200px;width:100%"/>
                <div style="position:absolute;top:10px;bottom:0;left:0;right:0">
                    <el-row type="flex" style="margin-top:10%" >
                        <el-col :xs="3" :sm="3" :md="3" :offset="2">
                            <img v-bind:src="backIcon" style="height:28px" @click="back"/>
                        </el-col>
                    </el-row>
                    <el-row type="flex" justify="center" >
                        <el-col class="imgCol">
                            <el-avatar :size="70" :src="info.head" >
                                    <img src="https://cube.elemecdn.com/e/fd/0fc7d20532fdaf769a25683617711png.png" />
                                </el-avatar>
                        </el-col>
                    </el-row>
                    <el-row type="flex" justify="center">
                        <el-col class="imgCol">
                            <span class="nameCss">{{info.nickname}}</span>
                        </el-col>
                    </el-row>
                </div>
            </div>
        </el-header>
        <el-main id="zhuYeMainPosition" >
            <div class="imgCol">
            <div class="zhuYeBox" style="z-index:2">
                <!-- <div class="imgCol">
                    <img src="../../assets/img/mine/geRenZhuYe/background.png" style="width:95%;height:350px" />
                </div> -->
                <el-row type="flex" class="infoCss" style="height:50px;margin-top:20px">
                    <el-col :xs="6" :sm="6" :md="6" :offset="3">
                        <span>新职通账号</span>
                    </el-col>
                    <el-col :xs="12" :sm="12" :md="12" :offset="1">
                        <span>{{info.username}}</span>
                    </el-col>
                </el-row>
                <el-row type="flex"  class="infoCss" style="height:50px">
                    <el-col :xs="6" :sm="6" :md="6" :offset="3">
                        <span>真实姓名</span>
                    </el-col>
                    <el-col :xs="6" :sm="8" :md="8" :offset="1" >
                        <span>{{info.realname}}</span>
                    </el-col>
                
                        <el-col v-if="info.hasQualification" :xs="4" :sm="3" :md="3">
                            <span class="shiMingBox">已实名</span>
                        </el-col>
                        <el-col v-else  :xs="4" :sm="3" :md="3"  >
                            <span class="notShiMingBox" @click="goToRenZhen">去认证</span>
                        </el-col>
                </el-row>
                <el-row type="flex"  class="infoCss" style="height:50px">
                    <el-col :xs="6" :sm="6" :md="6" :offset="3">
                        <span>地区</span>
                    </el-col>
                    <el-col :xs="12" :sm="12" :md="12" :offset="1">
                        <span>{{info.province}} {{info.city}} {{info.area}}</span>
                    </el-col>
                </el-row>
                <el-row type="flex"  class="infoCss" style="height:50px">
                    <el-col :xs="6" :sm="6" :md="6" :offset="3">
                        <span>生日</span>
                    </el-col>
                    <el-col :xs="12" :sm="12" :md="12" :offset="1">
                        <span>{{info.birthday}}</span>
                    </el-col>
                </el-row>
                <el-row type="flex"  class="infoCss" style="height:50px">
                    <el-col :xs="6" :sm="6" :md="6" :offset="3">
                        <span>职业</span>
                    </el-col>
                    <el-col :xs="12" :sm="12" :md="12" :offset="1">
                        <span>{{info.occupation}}</span>
                    </el-col>
                </el-row>
                <el-row type="flex"  class="infoCss" style="height:50px">
                    <el-col class="imgCol">
                        <button class="btnEdit" @click="goToEdit">编 辑</button>
                    </el-col>
                </el-row>
            </div>
            </div>
        </el-main>
    </el-container>
</div>
</template>
<script>
import titleImg from '../../assets/img/mine/geRenZhuYe/title.png'
import backgroundImg from '../../assets/img/mine/geRenZhuYe/background.png'
import backIcon from '../../assets/img/mine/geRenZhongXin/back.png'
import userPhoto from '../../assets/img/mine/geRenZhuYe/test.jpg'
import { Toast } from 'vant';
export default {    
    data(){
        return{
            //绑定是否实名认证
            renZhen:true,
            backIcon:backIcon,
            titleImg:titleImg,
            backgroundImg:backgroundImg,
            normalHeight:document.documentElement.clientHeight,
            userPhoto:userPhoto,
            info:{
                username:'',
                realname:'',
                nickname:'',
                occupation:'',
                hasQualification:false,
                birthday:'',
                province:'',
                city:'',
                area:'',
                head:'',
            }
        }
    },
    mounted(){
        var normalHeight=sessionStorage.getItem('normalHeight');

        var bg = document.getElementById("background");
       // normalHeight=document.documentElement.clientHeight;
        console.log("height:"+normalHeight);
        bg.style.height = normalHeight+"px";
        bg.style.backgroundColor = "#FFFFFF"
        bg.style.margin = "0px";

        // var head=document.getElementById("zhuYeHeadPosition");
        // var headHeight=normalHeight/20 *6;
        // console.log("headHeight:"+headHeight);
        // head.style.height=headHeight+"px";

        
        // var main=document.getElementById("zhuYeMainPosition");
        // var mainHeight=normalHeight/20 *14;
        // console.log("mainHeight:"+mainHeight);
        // main.style.height=mainHeight+"px";

        this.getGeRenZhuYe();
    },
    methods:{
        back(){
            console.log("back:");
            this.$router.go(-1);
        },
        goToEdit(){
            this.$router.push({
                path:'/mine/editInfo',
                query:{
                    info:this.info
                }
            })
        },
        goToRenZhen(){
            this.$router.push({
                path:'/mine/renZhen'
            })
        },
      //获取个人主页信息
        getGeRenZhuYe(){
            var URL=this.IP.IP+'/user/mainInfo';
            console.log(URL);
            this.$ajax({
                method:'get',
                url:URL,
            }).then(response=>{
                console.log(response.data);
                var code=response.data.code;
                if(code==0){
                    this.info=response.data.data;
                }else{
                    Toast(response.data.msg);
                }
            }).catch(error=>{
                console.log(error);
                //Toast(error);
            })
        }
    }
}
</script>
<style>
.el-main,.el-header,.el-aside,.el-footer{
    padding: 0px ;
}
#zhuYeTitleBack{
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    
    width: 100%;
    background: url(../../assets/img/mine/background.png) no-repeat;
    /**相应图片按比例伸缩*/
    background-size:120%;

}
.zhuYeBox{
    background-color: #fff;
    width: 90%;
    height:350px;
    border:#E0E0E0 1px solid;
    box-shadow: 10px 10px 5px 1px #E0E0E0;

    border-radius: 20px;

}
#zhuYeBack{
    position: absolute;
    top: 200px;
    left: 0;
    right: 0;
    bottom: 0;
   
    margin:0 auto;
    width: 95%;
    background: url(../../assets/img/mine/geRenZhuYe/background.png) no-repeat;

    background-size: 100%;
}
.imgCol{
    display:flex;
    align-items:center;
    justify-content:center
}
.el-avatar {
    display: inline-block;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    text-align: center;
    overflow: hidden;
    color: #fff;
    background: #fff;
    width: 40px;
    height: 40px;
    line-height: 40px;
    font-size: 14px;
}
.nameCss{
    color: #fff;
    font-size: 1em;
}
.infoCss{
    color: #707070;
 
}
.btnEdit{
    background-color: #53cdf5;
    height: 40px;
    width: 60%;
    color: #fff;
    font-size: 1.125em;
    outline: none;
    -webkit-border-radius: 25px;
    -moz-border-radius: 25px;
    -ms-border-radius: 25px;
    -o-border-radius: 25px;
    border-radius: 25px;
    border-style: none;

}
.shiMingBox{
    font-size: 0.9em;
    border: #53cdf5 1px solid;
    border-radius: 3px;
    color: #53cdf5;
}
.notShiMingBox{
     font-size: 0.9em;
    border: rgba(255, 69, 0, 0.68) 1px solid;
    border-radius: 3px;
    color: rgba(255, 69, 0, 0.68)
}
@media screen and (min-height: 800px){
    #zhuYeBack{
        top: 18%;
    }
    .infoCss{
        height: 8%;
    }
}
@media screen and (max-height: 600px){
    .nameCss{
    font-size: 13px;
}
    
}
</style>
